package com.tingyuge.base.design.proxy.proxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @Created by xiaodao
 *
 *
 */
public class StarHandler implements InvocationHandler {

    private Star star;

    public StarHandler(Star star) {
        this.star = star;
    }

    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {

        method.invoke(star,args);
        if (method.getName().equals("sing")){
            System.out.println("本人唱歌要加钱");
        }
        return null;
    }
}
